//
//  LSZNewWithPlusSignAudioTableViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/5/14.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZNewWithPlusSignAudioTableViewCell.h"


@implementation LSZNewWithPlusSignAudioTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        self.butAdd = [[UIButton alloc]init];
        [self addSubview:self.butAdd];

//        UIImageView * imageViewAdd = [[UIImageView alloc]init];
//        imageViewAdd.image = [UIImage imageNamed:@"添加单曲"];
//        [self.butAdd addSubview:imageViewAdd];

        self.labelNumber = [[UILabel alloc]init];
        self.labelNumber.textColor = lightColor;
        self.labelNumber.textAlignment = NSTextAlignmentCenter;
//        self.labelNumber.hidden = YES;
        self.labelNumber.font = [LSZSpecialPackaging setlabelTextFontAdaptiveSize:15];
        [self addSubview:self.labelNumber];

        self.labelSong = [[UILabel alloc]init];
        self.labelSong.textColor = titleColorLSZ;
        [LSZSpecialPackaging setLabel_14_5_Size:self.labelSong];
        [self addSubview:self.labelSong];

        self.labelAlbums = [[UILabel alloc]init];
        self.labelAlbums.textColor = lightColor;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelAlbums font:13];
        [self addSubview:self.labelAlbums];

        self.imageViewHeadset = [[UIImageView alloc]init];
        self.imageViewHeadset.image = [UIImage imageNamed:@"耳机_次数"];
        [self addSubview:self.imageViewHeadset];

        self.labelPlaysNumber = [[UILabel alloc]init];
        self.labelPlaysNumber.textColor = lightColor;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelPlaysNumber font:13];
        [self addSubview:self.labelPlaysNumber];

        self.butMove = [[UIButton alloc]init];
        [self addSubview:self.butMove];

        UIImageView * imageViewMove = [[UIImageView alloc]init];
        imageViewMove.image = [UIImage imageNamed:@"类别"];
        [self.butMove addSubview:imageViewMove];
        //45 50 60 55
        if (ScreenWidth == 320) {
            //5
            self.butAdd.frame = CGRectMake(0, 0, 50, 45);
            self.labelNumber.frame = CGRectMake(0, 0, 50, 45);
//            imageViewAdd.frame =  CGRectMake((self.butAdd.frame.size.width-18)/2,(self.butAdd.frame.size.height-18)/2, 18, 18);
            self.labelSong.frame = CGRectMake(CGRectGetMaxX(self.butAdd.frame), 6.5,ScreenWidth-CGRectGetMaxX(self.butAdd.frame)-60, 15);
            self.labelAlbums.frame = CGRectMake(CGRectGetMaxX(self.butAdd.frame), CGRectGetMaxY(self.labelSong.frame)+3,  ScreenWidth-CGRectGetMaxX(self.butAdd.frame)-60, 14);
            self.imageViewHeadset.frame = CGRectMake(CGRectGetMaxX(self.labelAlbums.frame)+5.5, CGRectGetMaxY(self.labelSong.frame)+3,13,13);
            self.labelPlaysNumber.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeadset.frame)+2, CGRectGetMaxY(self.labelSong.frame)+3, ScreenWidth-CGRectGetMaxX(self.imageViewHeadset.frame)-2, 14);
            self.butMove.frame = CGRectMake(ScreenWidth-50-10, 0, 50, 45);
            imageViewMove.frame =  CGRectMake(10,(self.butMove.frame.size.height-20)/2, 20, 20);
        }else if(ScreenWidth == 375){
            // 6 7
            self.butAdd.frame = CGRectMake(0, 0, 50, 50);
            self.labelNumber.frame = CGRectMake(0, 0, 50, 50);
//            imageViewAdd.frame =  CGRectMake((self.butAdd.frame.size.width-19)/2,(self.butAdd.frame.size.height-19)/2, 17, 17);
            self.labelSong.frame = CGRectMake(CGRectGetMaxX(self.butAdd.frame), 8.5,ScreenWidth-CGRectGetMaxX(self.butAdd.frame)-60, 16);
            self.labelAlbums.frame = CGRectMake(CGRectGetMaxX(self.butAdd.frame), CGRectGetMaxY(self.labelSong.frame)+3,  ScreenWidth-CGRectGetMaxX(self.butAdd.frame)-60, 15);
            self.imageViewHeadset.frame = CGRectMake(CGRectGetMaxX(self.labelAlbums.frame)+5.5, CGRectGetMaxY(self.labelSong.frame)+3,14,14);
            self.labelPlaysNumber.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeadset.frame)+2, CGRectGetMaxY(self.labelSong.frame)+3, ScreenWidth-CGRectGetMaxX(self.imageViewHeadset.frame)-2, 15);
            self.butMove.frame = CGRectMake(ScreenWidth-50-10, 0, 50, 50);
            imageViewMove.frame =  CGRectMake(10,(self.butMove.frame.size.height-20.5)/2, 20.5, 20.5);
        }
        else {
            //plus
            self.butAdd.frame = CGRectMake(0, 0, 50,58);
            self.labelNumber.frame = CGRectMake(0, 0, 50, 58);
//            imageViewAdd.frame =  CGRectMake((self.butAdd.frame.size.width-19)/2,(self.butAdd.frame.size.height-20)/2, 20, 20);
            self.labelSong.frame = CGRectMake(CGRectGetMaxX(self.butAdd.frame),9.5,ScreenWidth-CGRectGetMaxX(self.butAdd.frame)-60, 18);
            self.labelAlbums.frame = CGRectMake(CGRectGetMaxX(self.butAdd.frame), CGRectGetMaxY(self.labelSong.frame)+3,  ScreenWidth-CGRectGetMaxX(self.butAdd.frame)-60, 17);
            self.imageViewHeadset.frame = CGRectMake(CGRectGetMaxX(self.labelAlbums.frame)+5.5, CGRectGetMaxY(self.labelSong.frame)+3,15,15);
            self.labelPlaysNumber.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeadset.frame)+2, CGRectGetMaxY(self.labelSong.frame)+3, ScreenWidth-CGRectGetMaxX(self.imageViewHeadset.frame)-2, 17);
            self.butMove.frame = CGRectMake(ScreenWidth-50-10, 0, 50, 58);
            imageViewMove.frame =  CGRectMake(10,(self.butMove.frame.size.height-21)/2, 21, 21);
        }
    }
    return self;
}
///是否是选中当前这首  ,  为主题颜色
- (void)didSelectRowCellWithIsSystemRed:(BOOL)isSystemRed {
    if (isSystemRed) {
        self.labelSong.textColor  = RGBColor(238, 82, 74);
        self.labelAlbums.textColor= RGBColor(238, 82, 74);
        self.labelPlaysNumber.textColor = RGBColor(238, 82, 74);
        self.imageViewHeadset.image = [UIImage imageNamed:@"耳机_红"];
    }else{
        self.labelSong.textColor  = titleColorLSZ;
        self.labelAlbums.textColor= lightColor;
        self.labelPlaysNumber.textColor = lightColor;
        self.imageViewHeadset.image = [UIImage imageNamed:@"耳机_次数"];
    }
}
///判断是否是选中当前这首  ,  为主题颜色
- (void)didSelectRowCellWithRowAtIndexPath:(NSIndexPath *)indexPath{
    if (_LCPlayer.selectedIndex == indexPath.row && [[LCHistoryDataManager loadOneSongsData] isEqualToString:self.labelSong.text] && [self.labelAlbums.text isEqualToString:_LCPlayer.playingSong.album]) {
        [self didSelectRowCellWithIsSystemRed:YES];
    } else {
        [self didSelectRowCellWithIsSystemRed:NO];
    }
}
@end
